<?python
    from onlineapidoc.model import (PAGE_TYPE_NORMAL_PAGE, PAGE_TYPE_LINK, PAGE_TYPE_DIR)
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" py:extends="'../master.kid'">

<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/>
    <title>Online API Doc - Setting for ${page.name}</title>
    <link href="/static/css/space.css" media="screen" rel="Stylesheet" type="text/css" />
</head>

<body>  
<h2 id="page_name" py:content="page.name">Title</h2>
<p />
<div id="page_setting">
<form id="form_page_setting" action="/page/page_setting_commit" method="post">
<table>
<tr>
<td width="120"><b>Title</b></td>
<td><input type="text" name="name" size="50" value="$page.name" /></td>
</tr>
<tr id="template_choice" py:if="PAGE_TYPE_NORMAL_PAGE==page.type">
<td><b>Template</b></td>
<td>
<select name="tmpl_or_lnk_id">
<option py:for="template in templates"
value="$template.id"
selected="${(None, '')[template.id == page.template.id]}">
${template.name}
</option>
</select>
</td>
</tr>
<tr id="link_dest" py:if="PAGE_TYPE_LINK==page.type">
<td><b>Link Destination(Page ID)</b></td>
<td><input type="text" name="tmpl_or_lnk_id" size="10" value="$page.content" /></td>
</tr>
<tr id="parent_id">
<td><b>Parent Page</b></td>
<td>
<select name="parent_id">
<option value="">Root</option>
<option py:for="pp in page.space.all_dir_pages"
value="$pp.id"
selected="${(None, '')[pp.id == parent]}">
${pp.name}
</option>
</select>
</td>
</tr>
<tr id="index_id" py:if="PAGE_TYPE_DIR==page.type">
<td><b>Default Page</b></td>
<td>
<select name="index_id">
<option value="">None</option>
<option py:for="child in page.sub_pages"
value="$child.id"
selected="${(None, '')[child.id == index]}">
${child.name}
</option>
</select>
</td>
</tr>
</table>
<input py:if="PAGE_TYPE_DIR==page.type" name="tmpl_or_lnk_id" type="hidden" value="" />
<input py:if="not PAGE_TYPE_DIR==page.type" name="index_id" type="hidden" value="" />
<input name="page_id" type="hidden" value="$page.id" />
<a href="#" onclick="submit('form_page_setting'); return false;">update</a>
<a href="#" onclick="history.back();">back</a>
</form>
</div>
</body>

</html>
